<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<c:choose>
	<c:when test="${q6 != nul}">
		<p>${fn:escapeXml("#{ db.((Customer as c) where c.ranks.groupName != 'Partner biznesowy' and count(c.deals) >= 5) };")}</p>
		<table class="table table-hover">
			<thead>
				<tr>
					<th>Klient</th>
					<th>Kategoria</th>
					<th>Ilośc umów</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach var="customer" items="${q6}">
					<tr>
						<td>
							<c:out value="${customer.firstName}"/> <c:out value="${customer.lastName}"/>
						</td>
						<td>
							<c:forEach var="rank" items="${customer.ranks}">
								<c:out value="${rank.groupName}" /> 
							</c:forEach>
						</td>
						<td>
							${fn:length(customer.deals)}
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</c:when>
	<c:otherwise>
		<p>Sorry no data found ;(</p>
	</c:otherwise>
</c:choose>
